home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / os2 / isp3009b.zip / ISPELL4.DOC < prev    next >
Text File  |  1992-09-08  |  25KB  |  540 lines

  1.  
  2.  
  3.  
  4.    local                                                            ISPELL(4)
  5.  
  6.  
  7.  
  8.    NAME
  9.      ispell - format of ispell dictionaries and affix files
  10.  
  11.    DESCRIPTION
  12.  
  13.      Ispell(1) requires two files to define the language that it is spell-
  14.      checking.  The first file is a dictionary containing words for the
  15.      language, and the second is an "affix" file that defines the meaning of
  16.      special flags in the dictionary.  The two files are combined by buil-
  17.      dhash (see ispell(1)) and written to a hash file which is not described
  18.      here.
  19.  
  20.      A raw ispell dictionary (either the main dictionary or your own personal
  21.      dictionary) contains a list of words, one per line.  Each word may
  22.      optionally be followed by a slash ("/") and one or more flags, which
  23.      modify the root word as explained below.  Depending on the options with
  24.      which ispell was built, case may or may not be significant in either the
  25.      root word or the flags, independently.  Specifically, if the compile-
  26.      time option CAPITALIZATION is defined, case is significant in the root
  27.      word; if not, case is ignored in the root word.  If the compile-time
  28.      option MASKBITS is set to a value of 32, case is ignored in the flags;
  29.      otherwise case is significant in the flags.  Contact your system
  30.      administrator or ispell maintainer for more information (or just experi-
  31.      ment).  The dictionary should be sorted with the -f flag of sort(1)
  32.      before the hash file is built; this is done automatically by mun-
  33.      chlist(1), which is the normal way of building dictionaries.
  34.  
  35.      The case of the root word controls the case of words accepted by ispell,
  36.      as follows:
  37.  
  38.      (1)  If the root word appears only in lower case (e.g., bob), it will be
  39.           accepted in lower case, capitalized, or all capitals.
  40.  
  41.      (2)  If the root word appears capitalized (e.g., Robert), it will not be
  42.           accepted in all-lower case, but will be accepted capitalized or all
  43.           in capitals.
  44.  
  45.      (3)  If the root word appears all in capitals (e.g., UNIX), it will only
  46.           be accepted all in capitals.
  47.  
  48.      (4)  If the root word appears with a "funny" capitalization (e.g.,
  49.           ITCorp), a word will be accepted only if it follows that capitali-
  50.           zation, or if it appears all in capitals.
  51.  
  52.      (5)  More than one capitalization of a root word may appear in the dic-
  53.           tionary.  Flags from different capitalizations are combined by OR-
  54.           ing them together.
  55.  
  56.      Redundant capitalizations (e.g., bob and Bob) will be combined by buil-
  57.      dhash and by ispell (for personal dictionaries), and can be removed from
  58.      a raw dictionary by munchlist.
  59.  
  60.      For example, the dictionary:
  61.  
  62.           bob
  63.           Robert
  64.           UNIX
  65.           ITcorp
  66.           ITCorp
  67.  
  68.      will accept bob, Bob, BOB, Robert, ROBERT, UNIX, ITcorp, ITCorp, and
  69.      ITCORP, and will reject all others.  Some of the unacceptable forms are
  70.      bOb, robert, Unix, and ItCorp.
  71.  
  72.      As mentioned above, root words in any dictionary may be extended by
  73.      flags.  Each flag is a single alphabetic character, which represents a
  74.      prefix or suffix that may be added to the root to form a new word.  For
  75.      example, in an English dictionary the D flag can be added to bathe to
  76.      make bathed.  Since flags are represented as a single bit in the hashed
  77.      dictionary, this results in significant space savings.  The munchlist
  78.      script will reduce an existing raw dictionary by adding flags when pos-
  79.      sible.
  80.  
  81.      When a word is extended with an affix, the affix will be accepted only
  82.      if it appears in the same case as the initial (prefix) or final (suffix)
  83.      letter of the word.  Thus, for example, the entry UNIX/M in the main
  84.      dictionary (M means add an apostrophe and an "s" to make a possessive)
  85.      would accept UNIX'S but would reject UNIX's.  If UNIX's is legal, it
  86.      must appear as a separate dictionary entry, and it will not be combined
  87.      by munchlist.  (In general, you don't need to worry about these things;
  88.      munchlist guarantees that its output dictionary will accept the same set
  89.      of words as its input, so all you have to do is add words to the dic-
  90.      tionary and occasionally run munchlist to reduce its size).
  91.  
  92.      As mentioned, the affix definition file describes the affixes associated
  93.      with particular flags.  It also describes the character set used by the
  94.      language.
  95.  
  96.      Although the affix-definition grammar is designed for a line-oriented
  97.      layout, it is actually a free-format yacc grammar and can be laid out
  98.      weirdly if you want.  Comments are started by a pound (sharp) sign (#),
  99.      and continue to the end of the line.  Backslashes are supported in the
  100.      usual fashion (\nnn, plus specials \n, \r, \t, \v, \f, \b, and the new
  101.      hex format \xnn).  Any character with special meaning to the parser can
  102.      be changed to an uninterpreted token by backslashing it; for example,
  103.      you can declare a flag named flag \*: or flag \::.
  104.  
  105.      The grammar will be presented in a top-down fashion, with discussion of
  106.      each element.  An affix-definition file must contain exactly one table:
  107.  
  108.           table     :    [headers] [prefixes] [suffixes]
  109.  
  110.      At least one of prefixes and suffixes is required.  They can appear in
  111.      either order.
  112.  
  113.           headers   :    [ options ] char-sets
  114.  
  115.      The headers describe options global to this dictionary and language.
  116.      These include the character sets to be used and the formatter, and the
  117.      defaults for certain ispell flags.
  118.  
  119.           options   :    { fmtr-stmt | bool-stmt | flag-stmt }
  120.  
  121.      The options statements define the defaults for certain ispell flags and
  122.      for the character sets used by the formatters.
  123.  
  124.           fmtr-stmt :    { nroff-stmt | tex-stmt }
  125.  
  126.      A fmtr-stmt describes characters that have special meaning to a for-
  127.      matter.  Normally, this statement is not necessary, but some languages
  128.      may have preempted the usual defaults for use as language-specific char-
  129.      acters.  In this case, these statements may be used to redefine the spe-
  130.      cial characters expected by the formatter.
  131.  
  132.           nroff-stmt     :    { nroffchars | troffchars } string
  133.  
  134.      The nroffchars statement allows redefinition of certain nroff control
  135.      characters.  The string given must be exactly five characters long, and
  136.      must list substitutions for the left and right parentheses ("()") , the
  137.      period ("."), the backslash ("\"), and the asterisk ("*").  (The right
  138.      parenthesis is not currently used, but is included for completeness.)
  139.      For example, the statement:
  140.  
  141.           nroffchars {}.\\*
  142.      would replace the left and right parentheses with left and right curly
  143.      braces for purposes of parsing nroff/troff strings, with no effect on
  144.      the others (admittedly a contrived example).  Note that the backslash is
  145.      escaped with a backslash.
  146.  
  147.           tex-stmt  :    { TeXchars | texchars } string
  148.  
  149.      The TeXchars statement allows redefinition of certain TeX/LaTeX control
  150.      characters.  The string given must be exactly thirteen characters long,
  151.      and must list substitutions for the left and right parentheses ("()") ,
  152.      the left and right square brackets ("[]"), the left and right curly
  153.      braces ("{}"), the left and right angle brackets ("<>"), the backslash
  154.      ("\"), the dollar sign ("$"), the asterisk ("*"), the period or dot
  155.      ("."), and the percent sign ("%").  For example, the statement:
  156.  
  157.           texchars ()\[]<\><\>\\$*.%
  158.  
  159.      would replace the functions of the left and right curly braces with the
  160.      left and right angle brackets for purposes of parsing TeX/LaTeX con-
  161.      structs, while retaining their functions for the tib bibliographic
  162.      preprocessor.  Note that the backslash, the left square bracket, and the
  163.      right angle bracket must be escaped with a backslash.
  164.  
  165.           bool-stmt :    { cmpnd-stmt | aff-stmt }
  166.  
  167.           cmpnd-stmt     :    compoundwords on-or-off
  168.  
  169.           aff-stmt       :    allaffixeson-or-off
  170.  
  171.           on-or-off :    { on | off }
  172.  
  173.      A bool-stmt controls certain ispell defaults that are best made
  174.      language-specific.  The allaffixes statement controls the default for
  175.      the -P and -m options to ispell. If allaffixes is turned off (the
  176.      default), ispell will default to the behavior of the -P flag: root/affix
  177.      suggestions will only be made if there are no "near misses".  If allaf-
  178.      fixes is turned on, ispell will default to the behavior of the -m flag:
  179.      root/affix suggestions will always be made.  The compoundwords statement
  180.      controls the default for the -B and -C options to ispell. If compound-
  181.      words is turned off (the default), ispell will default to the behavior
  182.      of the -B flag: run-together words will be reported as errors.  If com-
  183.      poundwords is turned on, ispell will default to the behavior of the -C
  184.      flag: run-together words will be considered as compounds if both are in
  185.      the dictionary.  This is useful for languages such as German and
  186.      Norwegian, which form large numbers of compound words.
  187.  
  188.           flag-stmt :    flagmarker character
  189.  
  190.      The flagmarker statement describes the character which is used to
  191.      separate affix flags from the root word in a raw dictionary file.  This
  192.      must be a character which is not found in any word (including in string
  193.      characters; see below).  The default is "/" because this character is
  194.      not normally used to represent special characters in any language.
  195.  
  196.           char-sets :    norm-sets [ alt-sets ]
  197.  
  198.      The character-set section describes the characters that can be part of a
  199.      word, and defines their collating order.  There must always be a defini-
  200.      tion of "normal" character sets;  in addition, there may be one or more
  201.      partial definitions of "alternate" sets which are used with various text
  202.      formatters.
  203.  
  204.           norm-sets :    [ deftype ] charset-group
  205.  
  206.      A "normal" character set may optionally begin with a definition of the
  207.      file suffixes that make use of this set.  Following this are one or more
  208.      character-set declarations.
  209.  
  210.           deftype : defstringtype name suffix*
  211.  
  212.      The defstringtype declaration gives a list of file suffixes which should
  213.      make use of the default string characters defined as part of the base
  214.      character set; it is only necessary if string characters are being
  215.      defined.  The name is a string giving the name associated with these
  216.      suffixes; usually it is a formatter name.  If the formatter is a member
  217.      of the troff family, "nroff" should be used for the name associated with
  218.      the most popular macro package; members of the TeX family should use
  219.      "tex".  Other names may be chosen freely, but they should be kept sim-
  220.      ple, as they are used in ispell 's -T switch to specify a formatter
  221.      type.  The suffixes are a whitespace-separated list of strings which, if
  222.      present at the end of a filename, indicate that the associated set of
  223.      string characters should be used by default for this file.  For example,
  224.      the suffix list for the troff family typically includes suffixes such as
  225.      ".ms", ".me", ".mm", etc.
  226.  
  227.           charset-group :     { char-stmt | string-stmt | dup-stmt}*
  228.  
  229.      A char-stmt describes single characters; a string-stmt describes charac-
  230.      ters that must appear together as a string, and which usually represent
  231.      a single character in the target language.  Either may also describe
  232.      conversion between upper and lower case.  A dup-stmt is used to describe
  233.      alternate forms of string characters, so that a single dictionary may be
  234.      used with several formatting programs that use different conventions for
  235.      representing non-ASCII characters.
  236.  
  237.           char-stmt :    wordchars character-range
  238.                     |    wordchars lowercase-range uppercase-range
  239.                     |    boundarychars character-range
  240.                     |    boundarychars lowercase-range uppercase-range
  241.           string-stmt    :    stringchar string
  242.                     |    stringchar lowercase-string uppercase-string
  243.  
  244.      Characters described with the boundarychars statement are considered
  245.      part of a word only if they are embedded between characters declared
  246.      with the wordchars or stringchar statements.
  247.  
  248.      If two ranges or strings are given in a char-stmt or string-
  249.      stmt,thefirstdescribes characters that are interpreted as lowercase and
  250.      the second describes uppercase.  In the case of a stringchar statement,
  251.      the two strings must be of the same length.  Also, in a stringchar
  252.      statement, the actual strings may contain both uppercase and characters
  253.      themselves without difficulty; for instance, the statement
  254.  
  255.           stringchar     "\\*(sS"  "\\*(Ss"
  256.  
  257.      is legal and will not interfere with (or be interfered with by) other
  258.      declarations of of "s" and "S" as lower and upper case, respectively.
  259.  
  260.      A final note on string characters: some languages collate certain spe-
  261.      cial characters as if they were strings.  For example, the German "a-
  262.      umlaut" is traditionally sorted as if it were "ae".  Ispell is not capa-
  263.      ble of this; each character must be treated as an individual entity.  So
  264.      in certain cases, ispell will sort a list of words into a different
  265.      order than the standard "dictionary" order for the target language.
  266.  
  267.           alt-sets  :    alttype alt-stmt*
  268.  
  269.      Because different formatters use different notations to represent non-
  270.      ASCII characters, ispell must be aware of the representations used by
  271.      these formatters.  These are declared as alternate sets of string char-
  272.      acters.
  273.  
  274.           alttype   :    altstringtype name suffix*
  275.  
  276.      The altstringtype statement introduces each set by declaring the associ-
  277.      ated formatter name and filename suffix list.  This name and list are
  278.      interpreted exactly as in the defstringtype statement above.  Following
  279.      this header are one or more alt-stmts which declare the alternate string
  280.      characters used by this formatter.
  281.  
  282.           alt-stmt       :    altstringchar alt-string std-string
  283.      The altstringchar statement describes alternate representations for
  284.      string characters.  For example, the -mm macro package of troff
  285.      represents the German "a-umlaut" as a\*:,while TeX uses the sequence
  286.      \"a.  If the troff versions are declared as the standard versions using
  287.      stringchar, the TeX versions may be declared as alternates by using the
  288.      statement
  289.  
  290.           altstringchar  \\\"a     a\\*
  291.  
  292.      When the altstringchar statement is used to specify alternate forms, all
  293.      forms for a particular formatter must be declared together as a group.
  294.      Also, each formatter or macro package must provide a complete set of
  295.      characters, both upper- and lower-case, and the character sequences used
  296.      for each formatter must be completely distinct.  Character sequences
  297.      which describe upper- and lower-case versions of the same printable
  298.      character must also be the same length.  It may be necessary to define
  299.      some new macros for a given formatter to satisfy these restrictions.
  300.      (The current version of buildhash does not enforce these restrictions,
  301.      but failure to obey them may result in errors being introduced into
  302.      files that are processed with ispell.)
  303.  
  304.      An important minor point is that ispell assumes that all characters
  305.      declared as wordchars or boundarychars will occupy exactly one position
  306.      on the terminal screen.
  307.  
  308.      A single character-set statement can declare either a single character
  309.      or a contiguous range of characters.  A range is given as in egrep and
  310.      the shell: [a-z] means lowercase alphabetics; [^a-z] means all but
  311.      lowercase, etc.  All character-set statements are combined (unioned) to
  312.      produce the final list of characters that may be part of a word.  The
  313.      collating order of the characters is defined by the order of their
  314.      declaration; if a range is used, the characters are considered to have
  315.      been declared in ASCII order.  Characters that have case are collated
  316.      next to each other, with the uppercase character first.
  317.  
  318.      The character-declaration statements have a rather strange behavior
  319.      caused by its need to match each lowercase character with its uppercase
  320.      equivalent.  In any given wordchars or boundarychars statement, the
  321.      characters in each range are first sorted into ASCII collating sequence,
  322.      then matched one-for-one with the other range.  (The two ranges must
  323.      have the same number of characters).  Thus, for example, the two state-
  324.      ments:
  325.  
  326.           wordchars [aeiou] [AEIOU]
  327.           wordchars [aeiou] [UOIEA]
  328.  
  329.      would produce exactly the same effect.  To get the vowels to match up
  330.      "wrong", you would have to use separate statements:
  331.  
  332.           wordchars a U
  333.           wordchars e O
  334.           wordchars i I
  335.           wordchars o E
  336.           wordchars u A
  337.  
  338.      which would cause uppercase 'e' to be 'O', and lowercase 'O' to be 'e'.
  339.      This should normally be a problem only with languages which have been
  340.      forced to use a strange ASCII collating sequence.  If your uppercase and
  341.      lowercase letters both collate in the same order, you shouldn't have to
  342.      worry about this "feature".
  343.  
  344.      The prefixes and suffixes sections have exactly the same syntax, except
  345.      for the introductory keyword.
  346.  
  347.           prefixes  :    prefixes flagdef*
  348.           suffixes  :    suffixes flagdef*
  349.           flagdef   :    flag [*] char : repl*
  350.  
  351.      A prefix or suffix table consists of an introductory keyword and a list
  352.      of flag definitions.  Flags can be defined more than once, in which case
  353.      the definitions are combined.  Each flag controls one or more repls
  354.      (replacements) which are conditionally applied to the beginnings or end-
  355.      ings of various words.
  356.  
  357.      Flags are named by a single character char.  Depending on a configura-
  358.      tion option, this character can be either any uppercase letter (the
  359.      default configuration) or any 7-bit ASCII character.  Most languages
  360.      should be able to get along with just 26 flags.
  361.  
  362.      If an asterisk (*) is placed before the flag character, it means that
  363.      this flag participates in cross-product formation.  This only matters if
  364.      the file contains both prefix and suffix tables.  If so, all prefixes
  365.      and suffixes marked with an asterisk will be applied in all cross-
  366.      combinations to the root word.  For example, consider the root fix with
  367.      prefixes pre and in, and suffixes es and ed.  If all flags controlling
  368.      these prefixes and suffixes are marked with an asterisk, then the single
  369.      root fix would also generate prefix, prefixes, prefixed, infix, infixes,
  370.      infixed, fix, fixes, and fixed.  Cross-product formation can produce a
  371.      large number of words quickly, some of which may be illegal, so watch
  372.      out.  If cross-products produce illegal words, munchlist will not pro-
  373.      duce those flag combinations, and the flag will not be useful.
  374.  
  375.           repl :    condition* > [ - strip-string , ] append-string
  376.  
  377.      A repl is a conditional rule for modifying a root word.  Up to 8 condi-
  378.      tions may be specified.  If the conditions are satisfied, the rules on
  379.      the right-hand side of the repl are applied, as follows:
  380.  
  381.      (1)  If a strip-string is given, it is first stripped from the beginning
  382.           or ending (as appropriate) of the root word.
  383.  
  384.      (2)  Then the append-string is added at that point.
  385.  
  386.      For example, the condition . means "any word", and the condition Y means
  387.      "any word ending in Y".  The following (suffix) replacements:
  388.  
  389.           Y    >    -Y,IES
  390.  
  391.      would change induce to inducement and fly to flies.  (If they were con-
  392.      trolled by the same flag, they would also change fly to flyment, which
  393.      might not be what was wanted.  Munchlist can be used to protect against
  394.      this sort of problem; see the command sequence given below.)
  395.  
  396.      No matter how much you might wish it, the strings on the right must be
  397.      strings of specific characters, not ranges.  The reasons are rooted dee-
  398.      ply in the way ispell works, and it would be difficult or impossible to
  399.      provide for more flexibility.  For example, you might wish to write:
  400.  
  401.           [EY] >    -[EY],IES
  402.  
  403.      This will not work.  Instead, you must use two separate rules:
  404.  
  405.           E    >    -E,IES
  406.           Y    >    -Y,IES
  407.  
  408.      The application of repls can be restricted to certain words with condi-
  409.      tions:
  410.  
  411.           condition :    { . | character | range }
  412.  
  413.      A condition is a restriction on the characters that adjoin, and/or are
  414.      replaced by, the right-hand side of the repl.  Up to 8 conditions may be
  415.      given, which should be enough context for anyone.  The right-hand side
  416.      will be applied only if the conditions in the repl are satisfied.  The
  417.      conditions also implicitly define a length; roots shorter than the
  418.      number of conditions will not pass the test.  (As a special case, a con-
  419.      dition of a single dot "." defines a length of zero, so that the rule
  420.      applies to all words indiscriminately).  This length is independent of
  421.      the separate test that insists that all flags produce an output word
  422.      length of at least four.
  423.  
  424.      Conditions that are single characters should be separated by white
  425.      space.  For example, to specify words ending in "ED", write:
  426.  
  427.           E D  >    -ED,ING        # As in covered > covering
  428.  
  429.      If you write:
  430.  
  431.           ED   >    -ED,ING
  432.  
  433.      the effect will be the same as:
  434.  
  435.           [ED] >    -ED,ING
  436.  
  437.      As a final minor, but important point, it is sometimes useful to rebuild
  438.      a dictionary file using an incompatible suffix file.  For example, sup-
  439.      pose you expanded the "R" flag to generate "er" and "ers" (thus making
  440.      the Z flag somewhat obsolete).  To build a new dictionary newdict that,
  441.      using newaffixes, will accept exactly the same list of words as the old
  442.      list olddict did using oldaffixes, the -c switch of munchlist is useful,
  443.      as in the following example:
  444.  
  445.           $ munchlist -c oldaffixes -l newaffixes olddict > newdict
  446.  
  447.      If you use this procedure, your new dictionary will always accept the
  448.      same list the original did, even if you badly screwed up the affix file.
  449.      This is because munchlist compares the words generated by a flag with
  450.      the original word list, and refuses to use any flags that generate ille-
  451.      gal words.  (But don't forget that the munchlist step takes a long time
  452.      and eats up temporary file space).
  453.  
  454.    EXAMPLES
  455.  
  456.      As an example of conditional suffixes, here is the specification of the
  457.      S flag from the English affix file:
  458.  
  459.           flag *S:
  460.               [^AEIOU]Y  >    -Y,IES    # As in imply > implies
  461.               [AEIOU]Y   >    S         # As in convey > conveys
  462.               [SXZH]     >    ES        # As in fix > fixes
  463.               [^SXZHY]   >    S         # As in bat > bats
  464.  
  465.      The first line applies to words ending in Y, but not in vowel-Y.  The
  466.      second takes care of the vowel-Y words.  The third then handles those
  467.      words that end in a sibilant or near-sibilant, and the last picks up
  468.      everything else.
  469.  
  470.      Note that the conditions are written very carefully so that they apply
  471.      to disjoint sets of words.  In particular, note that the fourth line
  472.      excludes words ending in Y as well as the obvious SXZH.  Otherwise, it
  473.      would convert "imply" into "implys".
  474.  
  475.      Although the English affix file does not do so, you can also have a flag
  476.      generate more than one variation on a root word.  For example, we could
  477.      extend the English "R" flag as follows:
  478.  
  479.           flag *R:
  480.              E           >    R         # As in skate > skater
  481.              E           >    RS        # As in skate > skaters
  482.              [^AEIOU]Y   >    -Y,IER    # As in multiply > multiplier
  483.              [^AEIOU]Y   >    -Y,IERS   # As in multiply > multipliers
  484.              [AEIOU]Y    >    ER        # As in convey > conveyer
  485.              [AEIOU]Y    >    ERS       # As in convey > conveyers
  486.              [^EY]       >    ER        # As in build > builder
  487.              [^EY]       >    ERS       # As in build > builders
  488.  
  489.      This flag would generate both "skater" and "skaters" from "skate".  This
  490.      capability can be very useful in languages that make use of noun, verb,
  491.      and adjective endings.  For instance, one could define a single flag
  492.      that generated all of the German "weak" verb endings.
  493.  
  494.    SEE ALSO
  495.      ispell1.doc
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.    10
  537.  
  538.  
  539.  
  540.